package dat;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import com.casestudy1.main.MainMidlet;
import com.casestudy1.view.View;
import com.sun.lwuit.*;
import com.sun.lwuit.animations.CommonTransitions;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.plaf.Border;
import com.sun.lwuit.plaf.Style;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
import java.io.IOException;

/**
 *
 * @author My PC
 */
public class rapchieuphim extends View {

    Command cmBack, cmExit;

    public rapchieuphim(final MainMidlet midlet) {
        super(midlet);
        Resources res = null;
        try {
            res = Resources.open("/mytheme.res");//open resource  

        } catch (IOException e) {
        }

        setLayout(new BoxLayout(BoxLayout.Y_AXIS));
        setTitle("Rạp chiếu phim");

        setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 1000));

        Label l1 = new Label("Choose Cenima :");
        l1.getStyle().setFont(res.getFont("Font1"));
        l1.getStyle().setFgColor(0x00CCFF);
        Label l2 = new Label("Choose Day :");
        l2.getStyle().setFont(res.getFont("Font1"));
        l2.getStyle().setFgColor(0x00CCFF);
        Label l3 = new Label("     ");

        String[] rap = {"Rạp quốc gia", "Rạp Megastar", "Rạp dân chủ", "Rạp tháng 8"};
        String[] ngay = {"Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7", "Chủ nhật"};
        ComboBox cb1 = new ComboBox(rap);
        ComboBox cb2 = new ComboBox(ngay);

        Style s1 = new Style();
        s1.setBorder(Border.createEmpty());
        s1.setBgImage(res.getImage("combobox1"));

        Style s2 = new Style();
        s2.setBorder(Border.createEmpty());
        s2.setBgImage(res.getImage("combobox2"));


        Style s3 = new Style();
        s3.setFgColor(0xffffff);
        s3.setBgColor(0x3B3B3B);

        UIManager.getInstance().setComponentStyle("ComboBoxItem", s3);

        cb1.setSelectedStyle(s1);
        cb1.setPressedStyle(s1);
        cb1.setUnselectedStyle(s1);
        cb2.setSelectedStyle(s2);
        cb2.setPressedStyle(s2);
        cb2.setUnselectedStyle(s2);

        Style s4 = new Style();
        s4.setBorder(Border.createEmpty());
        s4.setAlignment(CENTER);
        s4.setBgColor(0x000000);

        Button bt1 = new Button(res.getImage("button1"));
        bt1.getStyle().setAlignment(CENTER);
        bt1.getStyle().setBorder(Border.createEmpty());
        bt1.setPressedStyle(s4);
        bt1.getStyle().setPadding(1, 1, 1, 1);
        bt1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                midlet.showLCPForm();
            }
        });
        Button bt2 = new Button(res.getImage("button2"));
        bt2.getStyle().setAlignment(CENTER);
        bt2.getStyle().setBorder(Border.createEmpty());
        bt2.setPressedStyle(s4);
        bt2.getStyle().setPadding(1, 1, 1, 1);
        bt2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                midlet.showTTRForm();
            }
        });

        cmExit = new Command("Thoát") {
            public void actionPerformed(ActionEvent evt) {
                Display.getInstance().exitApplication();
            }
        };

        cmBack = new Command("Quay lại") {
            public void actionPerformed(ActionEvent evt) {

                midlet.showMainForm();
            }
        };
        addComponent(l1);
        addComponent(cb1);
        addComponent(l2);
        addComponent(cb2);
        addComponent(l3);
        addComponent(bt1);
        addComponent(bt2);
        setBackCommand(cmBack);
        addCommand(cmBack);
        addCommand(cmExit);


    }
}
